3.434 \(\int \cos ^2(c+d x) (a+b \tan ^2(c+d x)) \, dx\)

Optimal. Leaf size=33 \[ \frac{(a-b) \sin (c+d x) \cos (c+d x)}{2 d}+\frac{1}{2} x (a+b) \]

[Out]

((a + b)*x)/2 + ((a - b)*Cos[c + d*x]*Sin[c + d*x])/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0385714, antiderivative size = 33, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3675, 385, 203} \[ \frac{(a-b) \sin (c+d x) \cos (c+d x)}{2 d}+\frac{1}{2} x (a+b) \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Tan[c + d*x]^2),x]

[Out]

((a + b)*x)/2 + ((a - b)*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 3675

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> -Simp[((b*c - a*d)*x*(a + b*x^n)^(p +
 1))/(a*b*n*(p + 1)), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x] /
; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \cos ^2(c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx &=\frac{\operatorname{Subst}\left (\int \frac{a+b x^2}{\left (1+x^2\right )^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac{(a-b) \cos (c+d x) \sin (c+d x)}{2 d}+\frac{(a+b) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{2 d}\\ &=\frac{1}{2} (a+b) x+\frac{(a-b) \cos (c+d x) \sin (c+d x)}{2 d}\\ \end{align*}

Mathematica [A]  time = 0.0564466, size = 32, normalized size = 0.97 \[ \frac{2 (a+b) (c+d x)+(a-b) \sin (2 (c+d x))}{4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Tan[c + d*x]^2),x]

[Out]

(2*(a + b)*(c + d*x) + (a - b)*Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

Maple [A]  time = 0.036, size = 54, normalized size = 1.6 \begin{align*}{\frac{1}{d} \left ( b \left ( -{\frac{\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{2}}+{\frac{dx}{2}}+{\frac{c}{2}} \right ) +a \left ({\frac{\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{2}}+{\frac{dx}{2}}+{\frac{c}{2}} \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x)

[Out]

1/d*(b*(-1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)+a*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

Maxima [A]  time = 1.63994, size = 53, normalized size = 1.61 \begin{align*} \frac{{\left (d x + c\right )}{\left (a + b\right )} + \frac{{\left (a - b\right )} \tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*((d*x + c)*(a + b) + (a - b)*tan(d*x + c)/(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]  time = 1.72183, size = 77, normalized size = 2.33 \begin{align*} \frac{{\left (a + b\right )} d x +{\left (a - b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*((a + b)*d*x + (a - b)*cos(d*x + c)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \tan ^{2}{\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*tan(d*x+c)**2),x)

[Out]

Integral((a + b*tan(c + d*x)**2)*cos(c + d*x)**2, x)

________________________________________________________________________________________

Giac [B]  time = 1.40934, size = 228, normalized size = 6.91 \begin{align*} \frac{a d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + b d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + a d x \tan \left (d x\right )^{2} + b d x \tan \left (d x\right )^{2} + a d x \tan \left (c\right )^{2} + b d x \tan \left (c\right )^{2} - a \tan \left (d x\right )^{2} \tan \left (c\right ) + b \tan \left (d x\right )^{2} \tan \left (c\right ) - a \tan \left (d x\right ) \tan \left (c\right )^{2} + b \tan \left (d x\right ) \tan \left (c\right )^{2} + a d x + b d x + a \tan \left (d x\right ) - b \tan \left (d x\right ) + a \tan \left (c\right ) - b \tan \left (c\right )}{2 \,{\left (d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + d \tan \left (d x\right )^{2} + d \tan \left (c\right )^{2} + d\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(a*d*x*tan(d*x)^2*tan(c)^2 + b*d*x*tan(d*x)^2*tan(c)^2 + a*d*x*tan(d*x)^2 + b*d*x*tan(d*x)^2 + a*d*x*tan(c
)^2 + b*d*x*tan(c)^2 - a*tan(d*x)^2*tan(c) + b*tan(d*x)^2*tan(c) - a*tan(d*x)*tan(c)^2 + b*tan(d*x)*tan(c)^2 +
 a*d*x + b*d*x + a*tan(d*x) - b*tan(d*x) + a*tan(c) - b*tan(c))/(d*tan(d*x)^2*tan(c)^2 + d*tan(d*x)^2 + d*tan(
c)^2 + d)